package com.example;

import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author shanchong
 * @date 2021/4/9
 **/
public class ConcurrentHashMapDemo {

    public static void main(String[] args) {
//        StringBuffer sb1 = new StringBuffer();
//        StringBuffer sb2 = new StringBuffer();
//        StringBuffer sb3 = new StringBuffer();
//        for (int i = 0; i < 1000; i++) {
//            sb1.append(",").append(i);
//            int initialCapacity = i;
//            int i1 = initialCapacity + (initialCapacity >>> 1) + 1;
//            System.out.print(i + "=" + i1 + "=");
//            sb2.append(",").append(i1);
//            int n = i - 1;
//            n |= n >>> 1;
//            n |= n >>> 2;
//            n |= n >>> 4;
//            n |= n >>> 8;
//            n |= n >>> 16;
//            int i2 = n + 1;
//            System.out.println(i2);
//            sb3.append(",").append(i2);
//        }
//        System.out.println(sb1);
//        System.out.println(sb2);
//        System.out.println(sb3);
         ConcurrentHashMap<String, String> concurrentHashMap = new ConcurrentHashMap(65);
        for (int i = 0; i < 9999999; i++) {
            concurrentHashMap.put(i+"", i*10+"");
        }
        System.out.println(concurrentHashMap.get("5"));
    }

}
